Skip to content

docs: document mergeable population standard deviation - #2809

Open
v0y4g3r wants to merge 1 commit into
mainfrom
docs/welford-stddev
Open

docs: document mergeable population standard deviation#2809
v0y4g3r wants to merge 1 commit into
mainfrom
docs/welford-stddev

Conversation

@v0y4g3r

@v0y4g3r v0y4g3r commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

What changed

  • document stddev_pop_state, stddev_pop_merge, and stddev_pop_calc
  • explain their input, output, NULL, non-finite input, and malformed-state behavior
  • add an end-to-end example that persists minute-level states and verifies the merged result against direct stddev_pop aggregation
  • update both English and Chinese Nightly documentation

This documents the functions introduced by GreptimeTeam/greptimedb#8972.

Closes #2802

Scope

  • Documentation versions: Nightly
  • Languages: English, Chinese

The feature is introduced for GreptimeDB 1.3.0, so released documentation versions are not changed.

Verification

  • pnpm build
  • DOC_LANG=zh pnpm build
  • DOC_LANG=en pnpm check:links
  • DOC_LANG=zh pnpm check:links
  • git diff --check
  • manually compared the documented behavior and SQL result with GreptimeDB PR #8972

Checklist

  • I verified the content against the applicable GreptimeDB version.
  • I updated the relevant documentation versions and languages, or explained why not.
  • I checked changed links and anchors.
  • Navigation does not require an update because this extends an existing page.

Signed-off-by: Lei, HUANG <ratuthomm@gmail.com>
Copilot AI lite review requested due to automatic review settings August 31, 2026 09:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Nightly documentation for GreptimeDB’s mergeable population standard deviation state functions (stddev_pop_state, stddev_pop_merge, stddev_pop_calc) on the existing “Approximate Functions” reference page, including behavioral notes (NULL handling, malformed state behavior, non-finite inputs) and an end-to-end SQL example. The same content is added to both the English and Chinese Nightly docs.

Changes:

  • Documented stddev_pop_state, stddev_pop_merge, and stddev_pop_calc, including input/output types and NULL / malformed-state semantics.
  • Added an end-to-end SQL example that persists minute-level states, merges them, and compares the result to direct stddev_pop.
  • Applied the same documentation update to both English and Chinese Nightly pages.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
docs/reference/sql/functions/approximate.md Adds English docs section for mergeable Welford-based stddev_pop_* state/merge/calc functions with a full SQL example.
i18n/zh/docusaurus-plugin-content-docs/current/reference/sql/functions/approximate.md Adds the corresponding Chinese section and example, aligned with the English Nightly docs.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying greptime-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 806fcb5
Status: ✅  Deploy successful!
Preview URL: https://9c234bd8.greptime-docs.pages.dev
Branch Preview URL: https://docs-welford-stddev.greptime-docs.pages.dev

View logs


### `stddev_pop_state`

`stddev_pop_state(value)` is an aggregate function that creates a mergeable state from a `DOUBLE` expression and returns it as `BINARY`.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both stddev_pop_state and stddev_pop_merge explicitly reject DISTINCT in the merged implementation (Welford DISTINCT aggregations are not available). Since these are introduced here as aggregate functions, please document this limitation and mirror it in the Chinese page; otherwise users may reasonably expect stddev_pop_state(DISTINCT value) to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update docs for feat(function): add mergeable stddev_pop state functions

3 participants